package cn.edu.mju.dao;

import cn.edu.mju.pojo.Book;
import cn.edu.mju.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BookDao {

    //添加图书
//    @Insert("insert into book values(#{bookID},#{bookName},#{bookCounts},#{detail})")
    int addBook(Book book);

    //修改图书
//    @Update("update book set bookName = #{bookName},bookCounts = #{bookCounts},detail = #{detail} where bookID = #{bookID}")
    int updateBook(Book book);

    //删除图书
//    @Delete("delete from book where bookID = #{bookId}")
    int delBook(int bookId);

    //查询图书
//    @Select("select * from book where bookID = #{bookId}")
    Book queryBook(int bookId);

    //模糊查询图书
//    @Select("select * from book where bookName like CONCAT('%',CONCAT(#{name},'%'))")
    List<Book> searchBook(String bookName);

    //查询所有图书
//    @Select("select * from book")
    List<Book> findAllBook();

}
